package Reflect;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * 反射
 */
public class ReflectDemo1 {
    public static void main(String[] args) {

        // 获取类对象
        Class<String> stringClass = String.class;
//        System.out.println(stringClass);
//        String name = stringClass.getName();
//        System.out.println(name);
//        name = stringClass.getSimpleName();
//        System.out.println(name);
//        Class<?>[] classes = stringClass.getClasses();
//        System.out.println(Arrays.toString(classes));
//        Class<? extends Class> aClass = stringClass.getClass();
//        System.out.println(aClass);
//        Method[] methods = stringClass.getMethods();
//        System.out.println(Arrays.toString(methods));
//        Annotation[] annotations = stringClass.getAnnotations();
//        System.out.println(Arrays.toString(annotations));

        Constructor<?>[] constructors = stringClass.getConstructors();
        for (Constructor constructor : constructors){
            System.out.println(constructor.getGenericParameterTypes());
        }
    }
}
